home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1537 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: atglab.bls.com!Alun.Champion
  2. From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help on C++ error
  5. Date: 11 Jan 1996 15:52:16 GMT
  6. Organization: Computer People Inc.
  7. Message-ID: <ALUN.CHAMPION.96Jan11105216@g7240065.bridge.bst.bls.com>
  8. References: <96010.112507APCCU@CUNYVM.CUNY.EDU> <4d1rqc$sla@oxy.rust.net>
  9. NNTP-Posting-Host: bstfirewall.bst.bls.com
  10. In-reply-to: ebennett@rust.net's message of Thu, 11 Jan 1996 05:15:47 GMT
  11.  
  12. In article <4d1rqc$sla@oxy.rust.net> ebennett@rust.net writes:
  13.  
  14. : Paul Abrilla <APCCU@CUNYVM.CUNY.EDU> wrote:
  15.  
  16. :> Hi to all,
  17. :>  
  18. :> I'm just starting to code on C++, and was playing around with classes and
  19. :> came across an error and a warning when I try to compile the code below.
  20. :> The warning is complaining about the statement, 'int Cat::SetAge(age)'.
  21. :> It says, 'Style of function definition is now obsolete'.  I'm sorry I couldn't
  22. :> check my compiler's manual at this time.  On the other hand, the error says,
  23. :> 'Cat::SetAge(int)' is not a member of 'Cat' (line:19).  Any help will be
  24. :> appreciated.  Please send replies directly tp my account.  Thanks in advance.
  25. :>  
  26. :>  Stuff Deleted....
  27. :> 
  28. :> int Cat::SetAge(age)
  29. :> {
  30. :>   itsAge = age;
  31. :> }
  32.  
  33. : Change this to:
  34.  
  35. :   int Cat::SetAge(int age)
  36. :   {
  37. :    itsAge = age;
  38. :   }
  39.  
  40. : The style of declaring a parameter without its type is obsolete.
  41.  
  42. The declaration of the function in the class declaration was
  43.   void SetAge(int);
  44. so void has to be changed to int or vice-versa.
  45. If you change the declaration then this function needs a return statement.
  46.  
  47. Regards
  48.  
  49.    -A.
  50.  
  51.  
  52. -- 
  53. | A.Champion                |
  54.